<!DOCTYPE html>
<html lang="en">
<head>
    <script src="../js/vue.js"></script>
    <script src="../js/dayjs.min.js"></script>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    format time<h3>{{fmtTime}}</h3>
    format time<h3>{{time | timeformatter}}</h3>
    format time<h3>aa{{time | timeformatter('YYYY_MM_DD')}}</h3>
    format time<h3>{{time |timeformatter('YYYY_MM_DD') | timesplit}}</h3>
</div>
<script type="text/javascript ">

    const vm = new Vue({
        el:"#app",
        data:{
            time:1631803865737,
        },
        computed:{
            fmtTime(){
                return dayjs(Date.now()).format('YYYY-MM-DD HH:mm:ss')
            }
        },
        filters:{
            timeformatter(value,str='YYYY年MM月DD日 HH:mm:ss'){
                return dayjs(value).format()
            },
            timesplit(value){
                return value.slice(0,4)

            }
        }
    })
</script>
</body>
</html>